package com.happyrecyclingstation.controller.ai;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * AI接口
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/jobSeeker/chats")
public class JobseekerChatAIController {

    /**
     * 求职者AI聊天接口
     * @param content
     * @return
     */
    private final ChatClient chatClient;
    @GetMapping(produces = "text/html;charset=UTF-8")
    public Flux<String> chatClient(String content) {
        return chatClient.prompt()
                .user(content)
                .stream()
                .content();
    }
}
